package com.sync.syncmasterdata.usercenter.repository.oa;

import com.sync.syncmasterdata.usercenter.entity.oa.UserForOa;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

/**
 * oauser持久层 name & phone find
 */
@Repository
public interface UserForOaRepository extends JpaRepository<UserForOa, String> {

    @Query(nativeQuery = true,value = "select id,lastname from HRMRESOURCE where lastname=:lastname and rownum=1")
    UserForOa getUserIdByName(@Param(value = "lastname") String lastname);

    @Query(nativeQuery = true,value = "select id,lastname,departmentid from HRMRESOURCE where mobile=:phone and rownum=1")
    UserForOa getUserIdByPhone(@Param(value = "phone") String phone);
}
